package com.yuyou.activity.group.service.service.impl;

import com.yuyou.activity.group.service.entity.ActivityGroupbuyOrder;
import com.yuyou.activity.group.service.entity.ActivityGroupbuyOrderDetail;
import com.yuyou.activity.group.service.mapper.ActivityGroupbuyOrderDetailMapper;
import com.yuyou.activity.group.service.service.IActivityGroupbuyOrderDetailService;
import com.yuyou.activity.util.bean.ResBoolSimpleInfo;
import com.yuyou.activity.util.util.Sequence;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class ActivityGroupbuyOrderDetailServiceImpl implements IActivityGroupbuyOrderDetailService {

    @Autowired
    private ActivityGroupbuyOrderDetailMapper mapper;


    @Override
    public int deleteByPrimaryKey(Long activityGroupbuyOrderDetailId) {
        return mapper.deleteByPrimaryKey(activityGroupbuyOrderDetailId);
    }

    @Override
    public int insert(ActivityGroupbuyOrderDetail record) {
    	record.setActivityGroupbuyOrderDetailId(Sequence.getSequence().nextId());
    	record.setCreateTime(new Date());
        return mapper.insert(record);
    }

    @Override
    public ActivityGroupbuyOrderDetail selectByPrimaryKey(Long activityGroupbuyOrderDetailId) {
        return mapper.selectByPrimaryKey(activityGroupbuyOrderDetailId);
    }

    @Override
    public int updateByPrimaryKeySelective(ActivityGroupbuyOrderDetail record) {
        return mapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public List<Long> findSourceIdByOrderId(Long orderId) {
        return mapper.findSourceIdByOrderId(orderId);
    }

	@Override
	public List<ActivityGroupbuyOrderDetail> findSuccByOpenId7Phone(String projectCode,String openId,String phone) {
		return mapper.findSuccByOpenId7Phone(projectCode,openId,phone);
	}
	
	@Override
	public ResBoolSimpleInfo<String> add(ActivityGroupbuyOrderDetail record) {
		this.insert(record);
		return ResBoolSimpleInfo.getSuccessInfo();
	}
}